home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_084 / ed / ckglob.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  999b  |  59 lines

  1. /*
  2.  * Copyright 1987 Brian Beattie Rights Reserved.
  3.  *
  4.  * Permission to copy and/or distribute granted under the
  5.  * following conditions:
  6.  *
  7.  * 1). No charge may be made other than resonable charges
  8.  *    for reproduction.
  9.  *
  10.  * 2). This notice must remain intact.
  11.  *
  12.  * 3). No further restrictions may be added.
  13.  *
  14.  */
  15. #include <stdio.h>
  16. #include "tools.h"
  17. #include "ed.h"
  18.  
  19. ckglob()
  20. {
  21.     static TOKEN    *glbpat;
  22.     char    c, delim, *lin;
  23.     int    num, nmatch;
  24.     LINE    *ptr;
  25.  
  26.     c = toupper(*inptr);
  27.     nmatch = 0;
  28.  
  29.     if(c == 'G' || c == 'V')
  30.     {
  31.         delim = *++inptr;
  32.         if(delim <= ' ')
  33.             return(0);
  34.         if(inptr[0] != inptr[1])    /* if null string use last */
  35.         {
  36.             glbpat = optpat(glbpat);
  37.         }
  38.         if(*inptr == delim)
  39.             inptr++;
  40.         num = curln;
  41.         while(1)
  42.         {
  43.             if(num)        /* do not do zero */
  44.             {
  45.                 ptr = getptr(num);
  46.                 lin = gettxt(num);
  47.                 if(matchs(lin, glbpat, 0))
  48.                 {
  49.                     ptr->l_stat = (c == 'G' ? LGLOB:LEXCL);
  50.                     nmatch++;
  51.                 }
  52.             }
  53.             if((num = nextln(num)) == curln)
  54.                 break;
  55.         }
  56.     }
  57.     return(nmatch);
  58. }
  59.